<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//Js中创建对象的第一种写法
			var student1 = new Object();
			student1.name = "张三";
			student1.age = 18;
			// document.write(student1.name + "," + student1.age);

			//Js中创建对象的第二中写法:以键值对的形式展示
			var student2 = {
				name: "李四",
				age: 18
			};
			// document.write(student1.name + "," + student1.age);

			//对象数组
			var stus = [student1, student2];
			// for (var i = 0; i < stus.length; i++) {
			// 	document.write(stus[i].name + "," + stus[i].age);
			// }

			stus.forEach(s => {
				document.write(s.name + "," + s.age);

			})
		</script>
	</body>
</html>
